package com.xishu.entity.customer;

import com.xishu.annotation.dao.DefaultValue;
import com.xishu.annotation.lang.Lang;
import com.xishu.annotation.oplog.OplogAnnotation;
import com.xishu.entity.AbstractEntity;
import com.xishu.entity.oplog.OpName;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;

/**
 * 会员等级管理
 */
@Entity(name = "vip_level")
@Table(indexes = {@Index(columnList = "companyId")})
public class VipLevel extends AbstractEntity implements OpName {
    @Transient
    private String opName;

    @ApiModelProperty(value = "是否专门给VIP建立的等级")
    @OplogAnnotation(fieldName = "VIP等级")
    private Boolean vip;

    @ApiModelProperty(value = "归属哪一个公司")
    private Long companyId;

    @ApiModelProperty(value = "会员等级积分的开始值,左闭右开")
    @DefaultValue(defaultValue = "0")
    @OplogAnnotation(fieldName = "会员等级积分的开始值")
    private Integer startScore;

    @ApiModelProperty(value = "会员等级积分的结束值,左闭右开")
    @OplogAnnotation(fieldName = "会员等级积分的结束值")
    private Integer endScore;

    @ApiModelProperty(value = "会员等级中文名称")
    @Lang(key = "name")
    private String name;

    @ApiModelProperty(value = "会员等级中文名称")
    @Lang(key = "name")
    @OplogAnnotation(fieldName = "会员等级中文名称")
    private String name_zh;

    @ApiModelProperty(value = "会员等级英文名称")
    @Lang(key = "name")
    @OplogAnnotation(fieldName = "会员等级英文名称")
    private String name_en;

    @ApiModelProperty(value = "是否开启")
    @DefaultValue(defaultValue = "false")
    @OplogAnnotation(fieldName = "是否开启")
    private Boolean enable;

    //消费金额兑换积分规则
    @ApiModelProperty(value = "是否消费金额兑换积分（枚举值是1），还是按照消费次数兑换积分（枚举值是2）")
    @DefaultValue(defaultValue = "1")
    @OplogAnnotation(fieldName = "兑换积分规则")
    private Integer consumeByCost;

    @ApiModelProperty(value = "客人消费的金额数")
    @OplogAnnotation(fieldName = "客人消费的金额数")
    private Integer userCost;

    @ApiModelProperty(value = "客人消费的金额数对应的积分数,金额不足时，不添加积分")
    @OplogAnnotation(fieldName = "客人消费的金额数对应的积分数")
    private Integer userCostScore;

    @ApiModelProperty(value = "多少次付款之后获取积分")
    @DefaultValue(defaultValue = "1")
    @OplogAnnotation(fieldName = "多少次付款之后获取积分")
    private Integer costTime;

    @ApiModelProperty(value = "多少次付款成功后添加的积分")
    @OplogAnnotation(fieldName = "多少次付款成功后添加的积分")
    private Integer costTimeScore;

    public Integer getCostTimeScore() {
        return costTimeScore;
    }

    public void setCostTimeScore(Integer costTimeScore) {
        this.costTimeScore = costTimeScore;
    }

    public Integer getConsumeByCost() {
        return consumeByCost;
    }

    public void setConsumeByCost(Integer consumeByCost) {
        this.consumeByCost = consumeByCost;
    }

    public Integer getUserCost() {
        return userCost;
    }

    public void setUserCost(Integer userCost) {
        this.userCost = userCost;
    }

    public Integer getUserCostScore() {
        return userCostScore;
    }

    public void setUserCostScore(Integer userCostScore) {
        this.userCostScore = userCostScore;
    }

    public Integer getCostTime() {
        return costTime;
    }

    public void setCostTime(Integer costTime) {
        this.costTime = costTime;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public Boolean getVip() {
        return vip;
    }

    public void setVip(Boolean vip) {
        this.vip = vip;
    }

    public Integer getStartScore() {
        return startScore;
    }

    public void setStartScore(Integer startScore) {
        this.startScore = startScore;
    }

    public Integer getEndScore() {
        return endScore;
    }

    public void setEndScore(Integer endScore) {
        this.endScore = endScore;
    }

    public String getName_zh() {
        return name_zh;
    }

    public void setName_zh(String name_zh) {
        this.name_zh = name_zh;
    }

    public String getName_en() {
        return name_en;
    }

    public void setName_en(String name_en) {
        this.name_en = name_en;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void setOpName(String str) {
        this.opName = str;
    }

    @Override
    public String getOpName() {
        return opName;
    }

    @Override
    public String opType() {
        return "会员等级";
    }

    @Override
    public String[] fieldName() {
        return new String[]{"name"};
    }
}
